﻿@using System.Web.UI.WebControls
@model WeatheRx.DomainModel.Search.ComprehensiveSearchRequestModel
@{
    ViewBag.Title = "Search";
}
@using (Html.BeginForm(new {id="searchForm"}))
{
    <br/>
    <div class="row clearfix">
        <div class="panel panel-primary">
            <div class="panel-heading">
                <h2 class="panel-title">Search Applicants and Jobs</h2>
            </div>
            <div class="panel-body">
                <div class="row">
                    <div class="col-md-6">
                        <div class="table-responsive">
                            <table class="table table-condensed table-striped">
                                <tbody>
                                    <tr>
                                        <td>Last name</td>
                                        <td>@Html.TextBoxFor(m => m.LastName, new { @class = "form-control", placeholder = "Smith" })</td>
                                    </tr>
                                    <tr>
                                        <td>Street Address</td>
                                        <td>@Html.TextBoxFor(m => m.StreetAddress, new { @class = "form-control", placeholder = "1234 Foxhollow" })</td>
                                    </tr>
                                    <tr>
                                        <td>Phone Number</td>
                                        <td>@Html.TextBoxFor(m => m.PhoneNumber, new { @class = "form-control", placeholder = "(123) 456-7890" })</td>
                                    </tr>
                                    <tr>
                                        <td>SSN</td>
                                        <td>@Html.TextBoxFor(m => m.SSN, new { @class = "form-control", placeholder = "999-99-9999" })</td>
                                    </tr>
                            </table>
                        </div>
                    </div>
                    <div class="col-md-6">
                        <div class="table-responsive">
                            <table class="table table-condensed table-striped">
                                <tbody>

                                    <tr>
                                        <td>OCEAN Client #</td>
                                        <td>@Html.TextBoxFor(m => m.OceanId, new { @class = "form-control", placeholder = "123456789" })</td>
                                    </tr>
                                    <tr>
                                        <td>Contractor</td>
                                        <td>@Html.TextBoxFor(m => m.Contractor, new { @class = "form-control", placeholder = "Global Heating" })</td>
                                    </tr>
                                    <tr>
                                        <td>Inspector</td>
                                        <td>@Html.TextBoxFor(m => m.Inspector, new { @class = "form-control", placeholder = "John" })</td>
                                    </tr>
                                    <tr>
                                        <td>Job Number</td>
                                        <td>@Html.TextBoxFor(m => m.JobNum, new { @class = "form-control", placeholder = "CLE9999" })</td>
                                    </tr>
                                </tbody>
                            </table>
                        </div>
                    </div>
                </div>
                <div class="row">
                    <div class="col-sm-12">
                        <button class="btn btn-primary btn-lg center" id="searchBtn" type="button">
                            <div class="glyphicon glyphicon-search">
                            </div>
                            Search
                        </button>
                    </div>
                </div>
            </div>
        </div>
    </div>
}
<div class="row clearfix">
    <br />
    <br />
    <div class="col-md-12">

        <div id="searchResultsDiv">
        </div>
    </div>
</div>
<script type="text/javascript">
    var advancedSearch = advancedSearch || {};
    advancedSearch.ajax = function (searchModel) {
        $.ajax({
            type: 'POST',
            url: '@Url.Content("~/Search/Results")',
            data: searchModel,
            success: function (data) {
                kendo.ui.progress($('#searchResultsDiv'), false);
                $('#searchResultsDiv').html(data);
                $('#searchResults').DataTable();
            }
        });
        kendo.ui.progress($('#searchResultsDiv'), true);
    }

    advancedSearch.buttonSearch = function ($btn) {
        var $form = $btn.closest("form");
        advancedSearch.ajax($form.serialize());
    }
    $(document).ready(function () {
        $("#searchBtn").click(function () { advancedSearch.buttonSearch($(this)); });
    });
</script>